from redis import Redis


class Rediscon:
    def __init__(self):
        self.r = Redis(host='localhost', port=6379, db=1)

    # 存入数据
    def insertdata(self, key, *value):
        self.r.sadd(key, *value)

        # 取数据


    def getdata(self, key):
        res = self.r.smembers(key)
        if res:
            list=[]
            for i in res:
                list.append(str(i,encoding='utf8'))
            return list
        else:
            return None


rs = Rediscon()
